package com;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import com.Service.TimeTaskService;

public class Main {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(com.config.AppConfig.class);
        TimeTaskService timeTaskService = context.getBean(TimeTaskService.class);
        timeTaskService.executeTimeTask();

        // 为了看到输出效果，这里让主线程等待一会儿，实际项目中可根据需求处理线程池关闭等
        try {
            Thread.sleep(6000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        context.close();
    }
}